window.onload = function() {
			var uid = Cookie.getCookie('yhid')
			var item = document.querySelector('.item_wrapper');
			console.log(uid);

			var url8 = 'http://jx.xuzhixiang.top/ap/api/cart-list.php?id=' + uid;
			$.ajax({
				type: "get ",
				url: url8,
				async: true,
				success: function(res) {
					var obj = JSON.parse(res);
					var olis = '';
					console.log('添加成功')
					obj.data.forEach(function(wqObj, index) {
						olis += `
            <div class="detail " id="${index+1} "> 
				<p class="title ">
	            	<a href="# ">								            
							<img src="${wqObj.pimg} " alt="${wqObj.pname} " onerror="javascript:this.src='/wcsstore/emall/mobile30/images/93.jpg' ">													
					</a>
	            </p>					
	                <p class="infos "> 								          
	                	<a id="product_link_1 " href="# ">${wqObj.pname}</a>
	                	<br><span> 119110A82076071</span>
	                </p>
	                  <p class="procolor ">
		                浅金<br>													
					 </p> 												
						<p class="prosize ">
						S<br>														
						</p>							                	
								<div id="qty ">
									<p class="pronum1 " id="qty_1 ">数量:</p>
									<p class="pronum2 right-t num-sele ">
									<a href="javascript:; " class="num-minu "></a>
										<input type="text " pattern="[0-9]* " class="num " size="4 " value="1 ">
									<a href="javascript:; " class="num-add " data-pid="${wqObj.pid} " ></a>
									</p>
									<div class="clear_float "></div>
								</div>														
	                		<p class="price " ispric='${wqObj.pprice}'>
	                			<span >￥</span>
	                			<span class="isjjjqqq " data-price="${wqObj.pprice} ">${wqObj.pprice}</span>
	                		</p>
				<a id="item_1_delete " href="javascript:; " class="tochart-close " data-id="${wqObj.pid} " index=${index+1}>删除</a>
            <div class="clear "></div>
            
        </div>
        `
					})

					item.innerHTML = olis;
					console.log(olis)
					<!--更新购物车里的数量-->
					var iszjg = document.querySelector('.total span')
					var sicp = document.querySelector('.cp')

					var isjia = 0;
					$('.isjjjqqq').each(function() {
						console.log($(this).html())
						isjia += parseInt($(this).html())
					})
					console.log(isjia)

					iszjg.innerHTML = '￥' + isjia + '.00'
					sicp.innerHTML = '￥' + isjia + '.00'
					if(parseInt($('.num-minu').next().val()) == 1) {
						console.log('已经最低了')
						$('.num-minu').addClass('disable')
					}
					//数量减的按钮
					$('.num-minu').click(function() {
						console.log('你点击了数量减');
						$(this).next().val(parseInt($(this).next().val()) - 1);
						if($(this).next().val() <= 1) {
							console.log('已经最低了')
							$(this).addClass('disable')
						}
						if($(this).next().val() >= 2) {
							$(this).removeClass('disable')
						}
						var isnum = $(this).parent().parent().next().children('.isjjjqqq').attr('data-price')
						var num = parseInt(isnum)
						<!--var num= isnum.substring(isnum.indexOf('￥')+1,isnum.indexOf('.'))-->
						console.log('num:' + num)
						var isjq = num * parseInt($(this).next().val())
						$(this).parent().parent().next().children('.isjjjqqq').html(isjq + '.00')
						<!--总价格-->
						var isjia = 0;
						$('.isjjjqqq').each(function() {
							console.log($(this).html())
							isjia += parseInt($(this).html())
						})
						console.log(isjia)

						iszjg.innerHTML = '￥' + isjia + '.00'
						sicp.innerHTML = '￥' + isjia + '.00'
					})

					//数量增的按钮；
					$('.num-add').click(function() {
						console.log('你点击了数量加');

						$(this).prev().val(parseInt($(this).prev().val()) + 1)
						if($(this).prev().val() >= 2) {
							console.log('数量大于2')
							$(this).prev().prev().removeClass('disable')
						}
						var isnum = $(this).parent().parent().next().children('.isjjjqqq').attr('data-price')
						var num = parseInt(isnum)
						<!--var num= isnum.substring(isnum.indexOf('￥')+1,isnum.indexOf('.'))-->
						console.log('num:' + num)
						var isjq = num * parseInt($(this).prev().val())
						$(this).parent().parent().next().children('.isjjjqqq').html(isjq + '.00')

						<!--总价格-->
						var isjia = 0;
						$('.isjjjqqq').each(function() {
							console.log($(this).html())
							isjia += parseInt($(this).html())
						})
						console.log(isjia)
						iszjg.innerHTML = '￥' + isjia + '.00'
						sicp.innerHTML = '￥' + isjia + '.00'

						//添加接口
						/*var url = 'http://jx.xuzhixiang.top/ap/api/cart-update-num.php'
						$.ajax({
							type:"get",
							url:url,
							async:true,
							data:{
								uid:uid,
								pid:$(this).attr('data-pid'),
								pnum:$(this).prev().val()
							},
							success:function(){
								console.log(url)
							}
						});*/
					})

					<!--删除按钮的实现-->
					var delBtn = document.querySelectorAll('.tochart-close');
					for(let i = 0; i < delBtn.length; i++) {
						delBtn[i].onclick = function() {
							console.log('你点击了删除');
							var pid = this.getAttribute('data-id');
							var index = this.getAttribute('index');
							var ismove = document.getElementById(index)
							console.log(pid);
							var url9 = `http://jx.xuzhixiang.top/ap/api/cart-delete.php?uid=${uid}&pid=${pid}`
							$.ajax({
								type: "get ",
								url: url9,
								async: true,
								success: function(res) {
									console.log('删除成功');
									ismove.remove();
									location.href = 'carts.html'
								}
							});
						}
					}

				}
			});
		}